#ifndef __H_POSTED_H__
#define __H_POSTED_H__

#include "linux_def.h"
#include "core.h"
#include "event.h"

#define locked_post_event(ev, queue)	\
	if (ev->prev == NULL){		\
		ev->next = (event_t*)*queue;	\
		ev->prev = (event_t**)queue;	\
		*queue = ev;			\
		if (ev->next){			\
			ev->next->prev = &ev->next;	\
		}				\
	}else{					\
	}

#define post_event(ev, queue)			\
	locked_post_event(ev, queue);		\


#define delete_posted_event(ev)			\
	*(ev->prev) = ev->next;			\
	if (ev->next){				\
		ev->next->prev = ev->prev;	\
	}					\
	ev->prev = NULL;			

void event_process_posted(cycle_t *cycle, event_t **posted);
			
extern event_t *posted_events;
extern event_t *posted_accept_events;


#endif
